//
//  ItemEffect.m
//  GamePOPs
//
//  Created by Thi Huynh on 3/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ItemEffect.h"

@implementation ItemEffect

-(id) initWithColor:(ccColor3B)color :(CGPoint)pos
{
	if( (self=[super initWithTotalParticles:15]) ) 
    {
		// duration
		duration = 0.15f;
        self.emitterMode = kCCParticleModeGravity;
        // emits per second
		emissionRate = totalParticles/duration;
        
		// Gravity Mode: gravity
		self.gravity = ccp(0,0);
		
		// Gravity Mode: speed of particles
		self.speed = 350;
		self.speedVar = 300;
		
		// Gravity Mode: radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// Gravity Mode: tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
		
		// angle
		angle = 90;
		angleVar = 360;
        
		// emitter position
		CGSize winSize = [[CCDirector sharedDirector] winSize];
		self.position = ccp(winSize.width/2, winSize.height/2);
		posVar = CGPointZero;
		
		// life of particles
		life = 1.5f;
		lifeVar = 1.2;
		
		// size, in pixels
		startSize = 60;
		startSizeVar = 25;
		endSize = kCCParticleStartSizeEqualToEndSize;
        
        // color of particles
        //start color
        startColor.r = color.r;
		startColor.g = color.g;
		startColor.b = color.b;
		startColor.a = 0.5f;
		
        startColorVar=startColor;
        startColorVar.a=0;
		        
        //end color
        endColor=startColorVar;
        endColorVar=endColor;		
		self.texture = [[CCTextureCache sharedTextureCache] addImage:IMG_OBJECT_SMALL_BOMB];
        
		// additive
		self.blendAdditive = YES;
        
        [self setPosition:pos];
	}
	
	return self;
}




@end
